package core

import (
	"io/ioutil"
	"net/http"
	"bytes"
)

type PostProxyClient struct {
	
}
func (c *PostProxyClient) Excute(method, serverUrl string, body []byte) (resCode int, data []byte, err error) {
	var req *http.Request
	client := &http.Client{}
	req, err = http.NewRequest(method, serverUrl, bytes.NewBuffer(body))
	if err != nil {
		return
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded") //必须
	resp, err := client.Do(req)
	if err != nil {
		return
	}
	resCode = resp.StatusCode
	defer resp.Body.Close()
	data, err = ioutil.ReadAll(resp.Body)
	if err != nil {
		return
	}
	return
}
func GetPostProxyClient() *PostProxyClient {
	return &PostProxyClient{
	}
}
